main(n,k,i){long r;for(gets(&n);~scanf("%d%d",&n,&k);printf("%ld\n",r)){k=k>n-k?k:n-k;for(r=1,i=k+1;i<=n;i++)r=r*i/(i-k);}}
